<extend name="common:commonSimpleNewTemplate" />
<block name="main_content">
<div>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-title">
						<span class="icon"> <i class="icon-info-sign"></i>
						</span>
						<h5>订单发货详情</h5>
					</div>
					<div class="widget-content nopadding">
						<form novalidate="novalidate" id="basic_validate"
							name="basic_validate" action="/Dealer/partofexpressAction" method="post" onsubmit="return checkNum('{$isPart}')" class="form-horizontal">
	
									<input type="hidden" id="order_id" name="order_id" value="{$order_info_en.order_id}" >
									<input type="hidden"  name="isPart" value="{$isPart}">
	
						<div class="widget-content nopadding">
						
						<table class="table table-bordered table-striped"
							id="search_result">
							<thead>
								<tr>
									<th>订单编号</th>
									<th>商品名称</th>
									<th>购买数量</th>
									<th>单价</th>
									<th>购买价</th>
									<th>已发货数量</th>
									<th>实付金额</th>
								</tr>
							</thead>
							<tbody>
								<volist id="order_detail_en" name="order_detail_list" key="k">
								<tr class="odd gradeX">
									<td>{$order_detail_en.order_id}</td>
									<td>{$order_detail_en.style_name}</td>
									<td>{$order_detail_en.qty}</td>
									<td>{$order_detail_en.sale_price}</td>
									<td>{$order_detail_en.goods_payment_amount}</td>
									<td>{$order_detail_en.ship_qty}</td>
									<td>{$order_detail_en.payment_amount}</td>
								</tr>
							</volist>
							</tbody>							
						</table>
						</div>
					
						<if  condition="$isPart eq  2 ">
						<div class="control-group">
								<label class="control-label">发送数量:</label>							
								<div class="controls">
									<input type="text" id="ship_qty" name="ship_qty" value="{$order_detail_en['qty']-$order_detail_en['ship_qty']}" readonly="readonly">
									<input type="hidden"  name="order_detail_id" value="{$order_detail_en.oid}">
									<input type="hidden"  id="order_detail_qty" value="{$order_detail_en.qty}">
									<input type="hidden"  id="order_detail_shipqty" value="{$order_detail_en.ship_qty}">
									
								</div>
							</div>
						</if>
						  
							
							<div class="control-group">
								<label class="control-label">物流类型:</label>							
								<div class="controls">
									<select id="logistic_type" name="logistic_type" style="width:220px;">
					                
					                  <option value="1">干线物流</option>
					                  <option value="2">日日顺</option>
					                  <option value="3">其他物流</option>
					                </select>
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">物流公司名称:</label>							
								<div class="controls">
									<input type="text" id="logistic_name" name="logistic_name" >
								</div>
							</div>
							<div class="control-group">
								<label class="control-label">物流单号:</label>							
								<div class="controls">
									<input type="text" id="express_no" name="express_no">
								</div>
							</div>					   			
				  	        
				  	        <div class="control-group">
								<label class="control-label">发货仓:</label>							
								<div class="controls">
									<input type="text" id="shipping_warehouse" name="shipping_warehouse">
								</div>
							</div>		
						
						<div class="control-group">
								<label class="control-label">发货日期：</label>
								<div class="controls">									
									<input id="send_date" name="send_date" style="background-color: #fff;border: 1px solid #ccc;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;width:217px;color:#555;transition: border 0.2s linear 0s, box-shadow 0.2s linear 0s;" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
								</div>
							</div>
																				
						  <div class="control-group">
								<label class="control-label">备注:</label>							
								<div class="controls">
									<input type="text" id="remark" name="remark" >
								</div>
							</div>

                         
							<div class="form-actions">
								<input id="btn_submit" type="submit"   class="btn btn-success" value="确认发货">
							</div>
						</form>
					</div>
					</div>
					
				</div>
			</div>
		</div>
</div>
</block>
<block name="js_content" >
<script src="../../../Public/js/laydate/laydate.js"></script>
<script type="text/javascript">
function checkNum( index){
	
	if(parseInt(index) == 2){
		
		var qty= parseInt($('#ship_qty').val());
		if(isNaN(qty)){
			alert("输入数量必须为数字!");
			$('#ship_qty').val('');
			return false;
		}
		if(qty == 0 ){
			alert("输入数量必须大于零!");
			$('#ship_qty').val('');
			return false;
		}
		
		var sum = parseInt($('#order_detail_qty').val());
		var part= parseInt($('#order_detail_shipqty').val());
		
				
		if(qty > sum-part){
			
			alert('发货数量大于剩余待发数量！');
			return false;
		}
		
		return true;
	}
	
	return true;
	
}


</script>
</block>
